package com.yuezhu.constomview;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yuezhu.global.ApplicationContext;
import com.yuezhu.R;

import butterknife.ButterKnife;
import butterknife.InjectView;


/**
 * Created by zhao on 2016/5/4.
 */
public class TextBlankView extends LinearLayout {

    int screen_width;
    @InjectView(R.id.add_apartment_title)
    TextView addApartmentTitle;
    @InjectView(R.id.add_apartment_edittext)
    EditText addApartmentEdittext;


    public TextBlankView(Context context) {
        super(context);
        initView(context);
    }

    public TextBlankView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    public TextBlankView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        initView(context);
    }

    private void initView(Context context) {
        screen_width = ApplicationContext.getInstance().getScreen_width();
        View view = LayoutInflater.from(context).inflate(R.layout.layout_text_blank_view, this);
        ButterKnife.inject(this, view);
        /*addApartmentEdittext = (EditText) view.findViewById(R.id.add_apartment_edittext);
        addApartmentTitle = (TextView) view.findViewById(R.id.add_apartment_title);*/
        setParame();
    }

    public void setContent(String content) {
        addApartmentTitle.setText(content);
        addApartmentEdittext.setHint(content);
    }

    private void setParame() {
        LayoutParams params = (LayoutParams) addApartmentEdittext.getLayoutParams();
        params.width = screen_width / 3;
    }
}
